package com.isunland.managesystem.ui;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BasePagerActivity;

/**
 * 部门/人员多选 界面
 * 开发者: HuXiaoDan
 * 日期: 2017/1/6 17:08
 */
public class PDeptMultiListActivity extends BasePagerActivity {
  private int[] titles = { R.string.searchDept, R.string.selectPerson };
  private String from;
  private String jobNos;

  @Override protected void onCreate(Bundle arg0) {
    from = getIntent().getStringExtra(SearchPersonMultipleFragment.EXTRA_FROM);
    jobNos = getIntent().getStringExtra(AttendanceSummaryQueryFragment.REQUEST_JOB_NUMBER);
    super.onCreate(arg0);
  }

  @Override protected Fragment createFragmentOne() {
    //部门多选
    if (!TextUtils.isEmpty(jobNos) && jobNos.contains("'")) {
      return DeptmentMultiListFragment.newInstance(jobNos);
    } else {
      return DeptmentMultiListFragment.newInstance("");
    }
  }

  @Override protected Fragment createFragmentTwo() {
    //人员多选
    if (!TextUtils.isEmpty(jobNos) && jobNos.contains("'")) {
      return SearchPersonMultipleFragment.newInstance(from, "", true);
    } else {
      return SearchPersonMultipleFragment.newInstance(from, jobNos, true);
    }
  }

  @Override protected int[] createTitle() {
    return titles;
  }
}